package io.summer.ebean.entity;

import io.ebean.Model;
import io.ebean.annotation.WhenCreated;
import io.ebean.annotation.WhenModified;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import java.time.LocalDateTime;

/**
 * @author Moonlight
 */
@MappedSuperclass
public abstract class BaseEntity extends Model {
	@Id
	private Long id;

	@Version
	private Long version;

  @WhenCreated
  @Column(updatable = false)
  private LocalDateTime createdTime;

  @WhenModified
  private LocalDateTime updatedTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}
}
